from Base.Base import Base
from selenium.webdriver.common.by import By
from Common.Api_client import ApiClient
import time
class Page6_pay_config_add(Base):
    def __init__(self, driver):
        super().__init__(driver)
        self.client = ApiClient()

    # 支付管理模块
    def click_pay(self):
        by, value = self.client.get_locator("pay", "pay_loc")
        self.click((by, value))
    # 支付配置信息模块
    def click_pay_config(self):
        by, value = self.client.get_locator("pay", "pay_config_loc")
        self.click((by, value))
    # 点击添加支付配置按钮
    def click_pay_config_add(self):
        by, value = self.client.get_locator("pay", "pay_config_add_loc")
        self.click((by, value))
    # 选择用户信息
    def click_search1(self):
        by, value = self.client.get_locator("pay", "search1_loc")
        self.click((by, value))
    def click_xuanze1(self):
        by, value = self.client.get_locator("pay", "xuanze1_loc")
        self.click((by, value))
    # 选择产品信息
    def click_search2(self):
        by, value = self.client.get_locator("pay", "search2_loc")
        self.click((by, value))
    def click_xuanze2(self):
        by, value = self.client.get_locator("pay", "xuanze2_loc")
        self.click((by, value))
    # 输入风险预存期
    def send_riskDay(self,riskDay):
        by, value = self.client.get_locator("pay", "riskDay_loc")
        self.send_keys((by, value),riskDay)
    # 选择是否自动结算
    def click_radio_yes(self):
        by, value = self.client.get_locator("pay", "radio_yes_loc")
        self.click((by, value))
    # 输入ip白名单
    def send_merchantServerIp(self,merchantServerIp):
        by, value = self.client.get_locator("pay", "merchantServerIp_loc")
        self.send_keys((by, value),merchantServerIp)
    # 点击保存按钮
    def click_save(self):
        by, value = self.client.get_locator("pay", "pay_config_save_loc")
        self.click((by, value))
    # 获取上架信息
    # # 判断是否上架
    # def get_isshangjia_info(self):
    #     by, value = self.client.get_locator("pay", "pay_shangjia_loc")
    #     return self.get_location_text((by, value))
    # # 如果上架了，执行下架操作
    # def click_xiajia(self):
    #     by, value = self.client.get_locator("pay", "pay_shangjia_loc")
    #     self.click((by, value))
    # 如果没有上架，删除
    def click_delete(self):
        by, value = self.client.get_locator("pay", "pay_delect_loc")
        self.click((by, value))
    #
    # # 弹窗返回内容
    # def get_tean_text(self):
    #     by, value = self.client.get_locator("alert", "tan_text_loc")
    #     print(by, value)
    #     return self.get_location_text((by, value))

    # 弹窗返回内容
    def get_tean_text(self):
        by, value = self.client.get_locator("alert", "tan_text_loc")
        print(by, value)
        return self.get_location_text((by, value))

    # 弹窗确定按钮

    def click_que(self):
        by, value = self.client.get_locator("alert", "que_loc")
        self.click((by, value))
